import request, { downloadFile } from '@/utils/request'

const api = {
  description: '/assetManagement/create',
  updateDevice: '/assetManagement/update',
  deleteDevice: '/assetManagement/delete',
  findBypage: '/assetManagement/findByPage',
  batchDelete: '/assetManagement/batchDelete',
  importExcel: '/assetManagement/import',
  exportExcel: '/assetManagement/export'
}

export default api

// export function findUserByPage (parameter) {
//   return request({
//     url: api.findUserByPage,
//     method: 'get',
//     params: parameter
//   })
// }

export function descriptions(parameter) {
  return request({
    url: api.description,
    method: 'post',
    data: parameter
  })
}

export function findBypages(parameter) {
  return request({
    url: api.findBypage,
    method: 'get',
    params: parameter
  })
}

export function updateDevices(parameter) {
  return request({
    url: api.updateDevice,
    method: 'post',
    data: parameter
  })
}

export function deleteDevices(parameter) {
  return request({
    url: api.deleteDevice + '?id=' + parameter,
    method: 'post'
  })
}

export function batchDeletes(parameter) {
  return request({
    url: api.batchDelete,
    method: 'post',
    data: parameter
  })
}

export function importExcals(data, params) {
  return request({
    url: api.importExcel,
    method: 'post',
    data: data,
    params: params
  })
}


export function exportExcel(parameter) {
  return downloadFile({
    url: api.exportExcel,
    params: parameter
  })
}
